﻿@{
    OperatorModel operatorInfo = OperatorProvider.Provider.GetCurrent();
    string portrait = Url.Content("~/Content/image/loginuser.png");
    var menuList = MenuHelper.GetWebMenu();
}
@using Raffles.OA.Data;
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <title>莱佛士项目运营管理平台</title>
    <link href="~/Content/plugin/jquery.contextMenu/jquery.contextMenu.min.css" rel="stylesheet" />
    <link href="~/Content/plugin/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="~/Content/plugin/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="~/Content/adminlte/css/AdminLTE.min.css" rel="stylesheet" />
    <link href="~/Content/adminlte/css/skins/all-skins.min.css" rel="stylesheet" />
    <link href="~/Content/plugin/layer/layer.min.css" rel="stylesheet" />
    <link href="~/Content/adminlte/css/tab.css?v=1.0.2" rel="stylesheet" />
    <link href="~/Content/system/css/common.css?v=1.0.0" rel="stylesheet" />
    <link href="~/Content/plugin/pop/pop.css" rel="stylesheet" />
    <style>
        .context-menu-list {
            font-size: 13px !important;
        }

        .treeview-menu li a {
            padding: 9px 15px 9px 10px;
            padding-left: 52px;
        }

        .main-sidebar {
            background-color: #2f4050 !important;
        }

        .skin-blue .sidebar-menu > li:hover > a, .skin-blue .sidebar-menu > li.active > a, .skin-blue .sidebar-menu > li.menu-open > a {
            color: #fff;
            background-color: #2f4050 !important;
        }

        .skin-blue .sidebar-menu > li > .treeview-menu {
            margin: 0 1px;
            background: #293846 !important;
            border-left: 3px solid #3c8dbc;
        }

        .nav > li {
            position: relative;
            display: block;
        }

        .nav-header {
            padding: 15px 20px;
        }

        .sideTopDiv {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .image-right {
            float: right;
            margin-top: 12px;
        }

        .m-t-xs {
            color: #ffffff;
            font-size: 12px;
        }

        .sidebar-menu > li > a,
        .treeview-menu > li > a {
            font-weight: 600 !important;
        }

        body.sidebar-collapse .profile-element {
            display: none;
        }

        .dropdown-menu > li > a {
            border-radius: 3px;
            color: inherit;
            line-height: 25px;
            margin: 4px;
            text-align: left;
            font-weight: normal;
        }

        @@media screen and (max-width: 768px) {
            .content-tabs, .dropdown {
                display: none !important;
            }
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini fixed">
    <div class="wrapper">
        <!-- 页面顶部 -->
        <header class="main-header">
            <a href="#" class="logo">
                <span class="logo-mini">SINBC</span>
                <span class="logo-lg">莱佛士项目管理平台</span>
            </a>
            <nav class="navbar navbar-static-top">
                <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
                    <span class="sr-only">Toggle navigation</span>
                </a>
                <div class="navbar-custom-menu">
                    <ul class="nav navbar-nav">
                        <li class="dropdown user">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <img src='@portrait' class="user-image">
                                <span>@operatorInfo.RealName</span>
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="javascript:;" onclick="showChangePasswordForm()"><i class="fa fa-key"></i> 修改密码</a></li>
                            </ul>
                        </li>
                        <li><a a href="javascript:;" onclick="logOut()"><i class="fa fa-sign-out"></i></a></li>
                    </ul>
                </div>
            </nav>
        </header>

        <!-- 左侧菜单 -->
        <aside class="main-sidebar">
            <section class="sidebar">
                <ul class="sidebar-menu" data-widget="tree">
                    <li class="nav-header">
                        <div class="dropdown profile-element clear sideTopDiv">
                            <div class="image-left">
                                <img alt="image" src='@portrait' class="img-circle" height="45" width="45" />
                            </div>
                            <div class="image-right">
                                <span class="block m-t-xs">@operatorInfo.RealName,欢迎登录</span>
                            </div>
                        </div>
                    </li>
                    @{
                        foreach (var menu in menuList.Where(p => p.ParentId == 0).OrderBy(p => p.DisplayOrder))
                        {
                            if (!string.IsNullOrEmpty(menu.UrlAddress) && menu.Type == (int)MenuTypeEnum.Directory)
                            {
                                <li>
                                    <a class="J_menuItem" href='@menu.UrlAddress'>
                                        <i class="@menu.Icon"></i>
                                        <span class="nav-label">@menu.Name</span>
                                    </a>
                                </li>

                            }
                            else
                            {
                                <li class="treeview">
                                    <a href="#">
                                        <i class="@menu.Icon"></i>
                                        <span class="nav-label">@menu.Name</span>
                                        <span class="pull-right-container">
                                            <i class="fa fa-angle-left pull-right"></i>
                                        </span>
                                    </a>
                                    <ul class="treeview-menu">
                                        @foreach (var secondMenu in menuList.Where(p => p.ParentId == menu.Id).OrderBy(p => p.DisplayOrder))
                                        {
                                            if (secondMenu.Type == (int)MenuTypeEnum.NewPage)
                                            {
                                                <li>
                                                    @{
                                                        <a target="_blank" href='@secondMenu.UrlAddress'><i class="@secondMenu.Icon"></i> @secondMenu.Name</a>
                                                    }
                                                </li>
                                            }
                                            else
                                            {
                                                <li class="@(secondMenu.IsActive ? "active" : "")">
                                                    @{
                                                        if (menuList.Where(p => p.ParentId == secondMenu.Id && p.Type != (int)MenuTypeEnum.Button).Count() == 0)
                                                        {
                                                                                                        <a class="J_menuItem" href='@secondMenu.UrlAddress'>
                                                                                                            <i class="@secondMenu.Icon"></i>  <span class="nav-label">@secondMenu.Name</span>
                                                                                                            <span class="pull-right-container">
                                                                                                                @{
                                                                                                                    if (secondMenu.UrlAddress == "/Finance/Project/PayApply")
                                                                                                                    {
                                                                                                                        <small class="label pull-right bg-red" id="payApplyCount">0</small>
                                                                                                                    }
                                                                                                                }
                                                                                                            </span>
                                                                                                        </a>
                                                        }
                                                    }
                                                </li>
                                            }

                                        }
                                    </ul>
                                </li>
                            }
                        }
                    }
                </ul>
            </section>
        </aside>

        <!-- 右侧页签及内容 -->
        <div class="content-wrapper">
            <div class="content-tabs">
                <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i></button>
                <nav class="page-tabs J_menuTabs">
                    <div class="page-tabs-content">
                        <a href="javascript:;" class="active J_menuTab" data-id="/Home/Default">首页</a>
                    </div>
                </nav>
                <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i></button>

                <a href="#" class="roll-nav roll-right tabReload"><i class="fa fa-refresh"></i> 刷新</a>
                <a href="#" class="roll-nav roll-right fullscreen" id="fullScreen"><i class="fa fa-arrows-alt"></i></a>
            </div>
            <div class="J_mainContent" id="content-main">
                <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/Home/Default" frameborder="0" data-id="/Home/Default" seamless></iframe>
            </div>
        </div>

        <!-- 页面底部 -->
        <footer class="main-footer">
            <div class="pull-right hidden-xs">
                <b>Version</b> 1.0.0
            </div>
            <strong>Copyright &copy; 2013-@(DateTime.Now.Year) <a href="https://www.sinbc.org/" target="_blank">新加坡中国经济文化发展中心</a></strong> All rights	reserved.
        </footer>
        <div class="control-sidebar-bg"></div>

        <div id="pop" style="display:none">
            <div id="popHead">
                <a id="popClose" class="error" title="关闭"></a>
                <h2><i class="fa fa-star text-red"></i> 温馨提示</h2>
            </div>
            <div id="popContent">
            </div>
        </div>
    </div>
    <script src="~/Content/plugin/jquery/jquery.min.js"></script>
    <script src="~/Content/plugin/jquery.contextMenu/jquery.contextMenu.min.js"></script>
    <script src="~/Content/plugin/bootstrap/js/bootstrap.min.js"></script>
    <script src="~/Content/adminlte/js/adminlte.min.js"></script>
    <script src="~/Content/plugin/blockUI/jquery.blockUI.js"></script>
    <script src="~/Content/plugin/jquery-slimscroll/jquery.slimscroll.min.js"></script>
    <script src="~/Content/plugin/fullscreen/jquery.fullscreen.js"></script>
    <script src="~/Content/plugin/layer/layer.min.js"></script> 
    <script src="~/Content/framework/js/framework.min.js"></script>
    <script src="~/Content/framework/js/framework-data.js"></script>
    <script src="~/Content/plugin/pop/pop.js"></script>
     <script src="~/Content/adminlte/js/contabs.js?v=1.0.0"></script>
    @*<script src="~/Content/system/js/disable-devtool@latest.js"></script>*@

<script>
         //全局弹框
        //window.onload = function () {
        //    var data = [];
        //    data.push("【<span class='text-red text-bold'>新加坡考察团A</span>】服务完成,请尽快结算")
        //    data.push("【<span class='text-red text-bold'>新加坡考察团B</span>】服务完成,请尽快结算")
        //    data.push("【<span class='text-red text-bold'>新加坡考察团C</span>】服务完成,请尽快结算")
        //    data.push("【<span class='text-red text-bold'>新加坡考察团D</span>】服务完成,请尽快结算")
        //    new Pop(data,"/Sale/Project/Index",'项目管理');
        //}
        $(function () {
            $('.user>.dropdown-menu').css('min-width', $('.user').width() + "px");
            $(".J_menuItem").on('click', function () {
                var screenSizes = {
                    xs: 480,
                    sm: 768,
                    md: 992,
                    lg: 1200
                };
                if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
                    $("body").removeClass('sidebar-open');
                }
            });
            frame.ajax({
                url: '@Url.Action("GetPayApplyCount", "Home")',
                type: 'get',
                success: function (obj) {
                    if (obj.success) {
                        $('#payApplyCount').text(obj.data);
                    }
                }
            });
            @*DisableDevtool({
                ignore: () => {
                    return '@OperatorProvider.Provider.GetCurrent().IsSystem'.toUpperCase() === 'TRUE';
                }
            });*@
        })
        //退出登录
        function logOut() {
            frame.confirm("确认要退出登录吗？", function () {
                window.location.href = '@Url.Content("/Login/Logout")';
            });
        }
        //修改密码
        function showChangePasswordForm() {
            frame.openDialog({
                title: "修改密码",
                content: '@Url.Content("/Login/ChangePassword")',
                width: "450px",
                height: "350px",
                callback: function (index, layero) {
                    var iframeWin = window[layero.find('iframe')[0]['name']];
                    iframeWin.saveForm(index);
                }
            });
        }
</script>
</body>
</html>